package com.example.cachedesign.rocketmq;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/rocketmq")
public class RocketMqController {
    @Autowired
    private RocketMqHelper rocketMqHelper;


    @PostMapping("/send/{message}")
    public boolean send(@PathVariable String message) {
        rocketMqHelper.asyncSend("MESSAGE_SEND_TOPIC", MessageBuilder.withPayload(message).build());
        return true;
    }
}
